package cn.zgz.dao;

import cn.zgz.model.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import cn.zgz.dbhelper.DBHelper;
import cn.zgz.mapper.managerMapper;

public class managerDao {

	public int cherk(String managername, String managerno) throws ClassNotFoundException, SQLException {
		DBHelper db = new DBHelper();
		String sql = "SELECT * FROM manager";
		ResultSet rs = db.excuteQuery(sql);
		int i = 0;
		while(rs.next()) {
			if(rs.getString("mName").equals(managername)&&rs.getString("mNo").equals(managerno)) {
				i = 1;
			}
		}
		return i;
	}

	public List<managerModel> findAll() throws Exception{
		DBHelper db = new DBHelper();
		String sql = "SELECT * FROM manager";
		return db.excuteQuery(sql, new managerMapper());
	}

}
